<?php

class Light_View_Helper_Action extends Light_View_Helper_Abstract
{
    public function action($module = null, $controller = null, $action = null, array $params = array())
    {
        $module     = $module !== null ? $module : Light_Core::$defaultConfig['module'];
        $controller = $controller !== null ? $controller : Light_Core::$defaultConfig['controller'];
        $action     = $action !== null ? $action : Light_Core::$defaultConfig['action'];

        $controller = Light_Core::dispatch($module, $controller, $action, array());

        $controller->disableLayout();

        ob_start();

        Light_Core::execute($controller);

        Light_Core::display($controller);

        return ob_get_clean();
    }
}